package cn.iocoder.yudao.module.trade.controller.app.order.vo;

import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.framework.common.validation.Mobile;
import cn.iocoder.yudao.module.trade.enums.delivery.DeliveryTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

import java.util.List;

@Schema(description = "用户 App - 礼品卡 - 交易订单创建 Request VO")
@Data
public class AppTradeOrderGiftCardCreateReqVO {

    @Schema(description = "备注", example = "这个是我的订单哟")
    private String remark;

    @Schema(description = "商品项数组", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotEmpty(message = "商品不能为空")
    private List<AppTradeOrderGiftCardCreateReqVO.Item> items;

    @Schema(description = "配送方式", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    @InEnum(value = DeliveryTypeEnum.class, message = "配送方式不正确")
    private Integer deliveryType;

    @Schema(description = "收件人名称", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "")
    private String receiverName;

    @Schema(description = "收件人手机", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "")
    @Mobile(message = "收件人手机格式不正确")
    private String receiverMobile;

    @Data
    @Schema(description = "用户 App - 商品项")
    @Valid
    public static class Item {

        @Schema(description = "商品 SKU 编号", example = "2048")
        @NotNull(message = "商品 SKU 编号不能为空")
        private Long skuId;

        @Schema(description = "购买数量", example = "1")
        @Min(value = 1, message = "购买数量最小值为 {value}")
        private Integer count;

        @Schema(description = "购物车项的编号", example = "1024")
        private Long cartId;

        /**
         * 礼品卡购买的时候 不选择地址  使用礼品卡选择地址发货
         */
        @Schema(description = "收件地址编号", example = "1")
        private Long addressId;

    }

}
